package com.property.demo.repository;

import com.property.demo.model.Vehicle;
import com.property.demo.model.Owner;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface VehicleRepository extends JpaRepository<Vehicle, Long>, JpaSpecificationExecutor<Vehicle> {
    
    List<Vehicle> findByOwner(Owner owner);
    
    List<Vehicle> findByOwnerId(Long ownerId);
    
    Optional<Vehicle> findByLicensePlate(String licensePlate);
    
    List<Vehicle> findByLicensePlateContaining(String licensePlate);
    
    List<Vehicle> findByBrand(String brand);
    
    List<Vehicle> findByModel(String model);
    
    List<Vehicle> findByStatus(String status);
    
    List<Vehicle> findByType(String type);
    
    List<Vehicle> findByParkingLocation(String parkingLocation);
    
    List<Vehicle> findByBrandContaining(String brand);
    
    boolean existsByLicensePlate(String licensePlate);
} 